﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Hook.Environmental.Props;
using Hook.Environmental.Props.EnvironmentPieces;
using Hook.Environmental.Props.EnvironmentPieces.ForestPieces;
using Hook.Environmental.Props.Enemies;

namespace Hook.Environmental.Editors
{
    public class PropPalette
    {
        public static int SETS = 2;
        public static int[] PIECES = { 6, 3 };
        public static List<string>[] Palette = new List<string>[2];

        public const int DEBUG = 0;
        public const int FOREST = 1;
        
        //public List<List<Prop>>Palette;

        public PropPalette()
        {
            Palette[0] = new List<string>();
            Palette[0].Add("LargeRectangle.txt");
            Palette[0].Add("LargeTriangle.txt");
            Palette[0].Add("SmallRightTriangle.txt");
            Palette[0].Add("SmallIsoTriangle.txt");
            Palette[0].Add("SmallSquare.txt");
            Palette[0].Add("TinySquare.txt");
            Palette[0].Add("LevelStart.txt");
            Palette[0].Add("LevelFinish.txt");

            Palette[1] = new List<string>();
            Palette[1].Add("WoodPlatform.txt");
            Palette[1].Add("SnapTrap.txt");
            Palette[1].Add("Bird.txt");
            Palette[1].Add("Panther.txt");

            /*Palette = new List<List<Prop>>();
            for (int s = 0; s < SETS; s++)
            {
                Palette.Add(new List<Prop>());
                for (int p = 0; p < PIECES[s]; p++)
                {
                    Palette[s].Add(new Prop());
                    ReloadPaletteSlot(s, p);
                }
            }*/

            /*for(int l = 0; l < Palette.Count; l++)
            {
                Palette[l] = new List<Prop>();
            }*/
        }

        public Prop SwabPropFromPalette(int SetNumber, int PieceNumber)
        {
            if (SetNumber < Palette.Length)
            {
                if (PieceNumber < Palette[SetNumber].Count)
                {
                    Prop SwabProp = new Prop(Palette[SetNumber][PieceNumber]);
                    return SwabProp;
                }
                else
                {
                    return null;
                }
            }
            else
            {
                return null;
            }
        }

        /*public Prop SwabPropFromPalette(int SetNumber, int PieceNumber)
        {
            Prop SwabProp = Palette[SetNumber][PieceNumber];
            ReloadPaletteSlot(SetNumber, PieceNumber);
            return SwabProp;
        }

        public void ReloadPaletteSlot(int SetNumber, int PieceNumber)
        {
            switch (SetNumber)
            {
                case DEBUG: ReloadDebugSlot(PieceNumber); break;
                case FOREST: ReloadForestSlot(PieceNumber); break;
            }
        }

        public void ReloadDebugSlot(int PieceNumber)
        {
            switch(PieceNumber)
            {
                case 0: Palette[DEBUG][0] = new LargeRectangle(); break;
                case 1: Palette[DEBUG][1] = new LargeTriangle(); break;
                case 2: Palette[DEBUG][2] = new SmallIsoTriangle(); break;
                case 3: Palette[DEBUG][3] = new SmallRightTriangle(); break;
                case 4: Palette[DEBUG][4] = new SmallSquare(); break;
                case 5: Palette[DEBUG][5] = new TinySquare(); break;
            }
        }
        public void ReloadForestSlot(int PieceNumber)
        {
            switch (PieceNumber)
            {
                case 0: Palette[FOREST][0] = new WoodPlatform(); break;
                case 1: Palette[FOREST][1] = new SnapTrap(); break;
                case 2: Palette[FOREST][2] = new Bird(); break;
                case 3: Palette[FOREST][3] = new SmallRightTriangle(); break;
                case 4: Palette[FOREST][4] = new SmallSquare(); break;
                case 5: Palette[FOREST][5] = new TinySquare(); break;
            }
        }*/
    }
}
